﻿#pragma once

#include <learn/alg/alg_coeff_matrix.h>
#include <learn/alg/alg_distance.h>
#include <learn/geom/geom_bspline_surface.h>

namespace xi
{

namespace alg
{

using namespace xi::math;
using namespace xi::geom;

struct EXT_SYMBOL Alg_Energy
{
    /**
     * @brief 计算最小二乘误差
     *
     * @param[in] data
     * @param[in] params
     * @param[in] surface
     * @return double
     */
    static double surface_least_square_energy(const std::vector<Vec3> &data, const std::vector<Vec2> &params,
                                              std::shared_ptr<Geom_Surface<3>> surface);

    /**
     * @brief 计算拉伸和弯曲能量
     *
     * @param[in] surface
     * @return std::tuple<double, double>
     */
    static std::tuple<double, double> surface_stretch_bending_energy(std::shared_ptr<Geom_BSplineSurface<3>> surface);
};

} // namespace alg

} // namespace xi